﻿namespace Tester.Models;

internal class ItemSelector : DataTemplateSelector
{
    public DataTemplate Dts1 { get; set; }
    public DataTemplate Dts2 { get; set; }

    public ItemSelector()
    {
        Dts1 = new();
        Dts2 = new();
    }


    protected override DataTemplate OnSelectTemplate(object item, BindableObject container)
    {
        IWidget widget = item as IWidget;
        if (widget?.Mode == 0)
        {
            return Dts1;
        }
        else if (widget?.Mode == 1)
        {
            return Dts2;
        }

        return null;
    }
}